fix: repair failing tests and type errors across api and shared packages - #105
Open
stooit wants to merge 1 commit into
Open
fix: repair failing tests and type errors across api and shared packages#105stooit wants to merge 1 commit into
stooit wants to merge 1 commit into
Conversation
- shared/types: rename userName -> username to match API routes and tests - shared/pagination: implement paginate() (was a throwing stub) - api/auth middleware: fix case-sensitivity bug (public method 'post' -> 'POST') - api/users route: import badRequest, use canonical username field - tsconfig: add bun-types to types array to resolve process.env typing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes all failing tests and eliminates all type errors.
bun test && bunx tsc --noEmitnow passes: 22 tests pass, 0 failures, 0 type errors.Bugs spanned both the
apiandsharedpackages.Changes
packages/shared/src/types.tsuserName→usernameto match the field name used by API routes and tests.packages/shared/src/utils/pagination.tspaginate()— was a stub that threwnot implemented. Slices by page/size, computestotalandtotalPagesviaMath.ceil, handles empty arrays and out-of-range pages.packages/api/src/middleware/auth.ts'post'but Hono'sc.req.methodis uppercase'POST', soPOST /usersincorrectly required a token.packages/api/src/routes/users.tsbadRequestimport and switched to the canonicalusernamefield.tsconfig.json"types": ["bun-types"]to resolve theprocess.envtyping error.bun-typeswas already installed;strictremains on.Verification
bun test→ 22 pass / 0 failbunx tsc --noEmit→ clean (exit 0)Constraints honoured
bun-typespre-existing; package.json/lockfile unchanged).tsconfigchange does not weaken type safety.Assumptions
username(chosen because tests and route handlers use it; only the shared type diverged).